<template>
	<view class="IndexVideo">
		<view class="videobg" :style="'background-image: url('+bgPic+');'">
			<view class="myvideo">
				<video id="myVideo" @play="playVedio()" src="mp4" :controls="isFull" :poster='item.thumb'
					:src="item.url"></video>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'Indexvideo',
		props: {
			item: {
				type: Object,
				default: () => {
					return {}
				}
			}
		},
		data() {
			return {
				isFull:false, //是否全屏
				bgPic: '../../static/images/Index_banner3.png'
			};
		},
		mounted() {

		},
		created() {},
		methods: {
			playVedio() {
				// 获取 video 上下文 videoContext 对象
				this.videoContext = uni.createVideoContext('myVideo');
				// 进入全屏状态
				this.videoContext.requestFullScreen();
				this.isFull = true

			},

		}
	}
</script>

<style lang="scss">
	.IndexVideo {
		width: 100%;
		height: 100%;
		position: relative;

		.videobg {
			height: 100%;
			width: 100%;
			background-repeat: no-repeat;
			background-size: cover;
			background-position: center;
			position: relative;

			.myvideo {
				position: absolute;
				bottom: 0;
				left: 0;
				width: 100%;
				height: 100%;

				video {
					width: 100%;
					height: 100%;
				}
			}
		}
	}
</style>
